//系统配置-操作管理
App.pages.add((function(){
    var NS = Admin.Access.Operation;
    var page = new App.Page({
        name: 'access/operation/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-folder"></i>',
            content: '系统配置'
        }, {
            content: '操作管理'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/access/operation',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'select', title: '所属分组', name: 'group_id', width: '250px',
                    items: App.models.get('operationGroups'),
                    item_key: 'group_id', 
                    item_name: 'name'
                }
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.access.operation.create'},
                {type: 'globe', permission: 'op:admin.access.operation.multiAdd', name: '批量添加', operation: function(dataTable){
                    var win = dataTable.wins.get('multiAdd');
                    win.setTitle('批量添加');
                    win.form.reset().add();
                    win.show();
                }},
                {parent: 'view', permission: 'op:admin.access.operation.detail'},
                {parent: 'edit', permission: 'op:admin.access.operation.update'},
                {parent: 'drop', permission: 'op:admin.access.operation.delete'},
                {parent: 'multiDrop', permission: 'op:admin.access.operation.multiDelete'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form)
                }
            },
            after: function(dataTable){
                dataTable.wins.add(new NS.MultiAdd(dataTable), 'multiAdd');
            }
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());